package com.ccq.farm.hello;/**
 * Created by HiWin10 on 2018-06-27.
 */

import com.ccq.farm.model.EcSku;
import com.ccq.farm.model.OauthUser;
import com.ccq.farm.service.EcSkuService;
import com.ccq.farm.service.OauthPermissionService;
import com.ccq.farm.service.OauthRoleService;
import com.ccq.farm.service.OauthUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Set;

/**
 * @author ccq
 * @create 2018-06-27 下午 23:36
 **/
@RestController
public class HelloController {

    @Autowired
    private EcSkuService ecSkuService;

    @Autowired
    private OauthUserService oauthUserService;

    @Autowired
    private OauthRoleService oauthRoleService;

    @Autowired
    private OauthPermissionService oauthPermissionService;

    @RequestMapping("/hello")
    public List<EcSku> shopList(){
        return ecSkuService.selectList(null);
    }

    @RequestMapping("/user")
    public List<OauthUser> userList(){
        return oauthUserService.selectList(null);
    }


    @RequestMapping("userInfo")
    public OauthUser userInfo(){
        return oauthUserService.findByUserNameAndPwd("ccq","222","ec");
    }



    @RequestMapping("roleList")
    public Set<String> roleSet(){
        Set<String>  set = oauthRoleService.findRoleByName("ccq", "ec");
        return set;
    }


    @RequestMapping("perSet")
    public Set<String> perSet(){
        Set<String>  set = oauthPermissionService.findPerByName("ccq", "ec");
        return set;
    }
}
